-
-
Notifications
You must be signed in to change notification settings - Fork 366
fix: do not mutate httpx client inside storage, postgrest and functions #1249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
instead, use `yarl.URL` to parse and manipulate the URL in a stateless way, by returning a new url when paths are appended
I do think letting the |
Pull Request Test Coverage Report for Build 18322053654Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will pull this code down and test against my local codebase.
It was either this or passing every parameter that |
Thank you, please let me know of the results.
The problem is that it is still happening, |
Just noticed that this problem is not only on these two libraries, |
@o-santi I'm getting an error while using these changes in my test setup locally. The error is below.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Async/SyncBucketActionsMixin
class is missing the base_url
and only has the path
as the URL hence the error above. This needs to be updated to match the Async/SyncStorageBucketAPI
use of base_url
.
What kind of change does this PR introduce?
Fix both
storage
andpostgrest
to not mutate external httpx client, given it is shared, by instead keeping their own copy of their parameters to pass into the request call. In order to properly manipulate URLs without mutation, I've decided to add theyarl
dependency, which returns a new object upon path manipulation.For the
postgrest
library, I've also decided to factor out all of the parameters that go into a request in aRequestConfig
object, for it is very easy to miss a spot otherwise. I've had to change the tests to account for this. However, I think this greatly simplifies most of the libraries, as 99% of the code does not need to be async/sync, and can be stated only once in a further rewrite.Additional context
Should fix #1245.